package thread;

import abstract_ex1.Main;

public class ThPingPongImplRunn implements Runnable {

    String palavra;
    long tempo;

    public ThPingPongImplRunn(String palavra, long tempo) {
        this.palavra = palavra;
        this.tempo = tempo;
    }

    @Override
    public void run() {
        try {
            for (int i = 0; i < 10; i++) {
                System.out.print(palavra + "-->");
                Thread.sleep(tempo);
            }
        } catch (InterruptedException e) {
        }
    }
    
    public static void main(String[] args){
        Runnable ping = new ThPingPongImplRunn("ping", 1500);
        Runnable pong = new ThPingPongImplRunn("PONG", 2000);
        System.out.println("Antes de estartar as Runnebles");
        new Thread(ping).start();
        new Thread(pong).start();
        System.out.println("Depois de estartar as Runnebles");
    }   
}
